<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wechat_chat_msg', function (Blueprint $table) {
            $table->id();
            $table->string('corp_id')->default('')->comment('企业ID');
            $table->string('user_id')->default('')->comment('发送成员ID');
            $table->string('chat_type')->default('')->comment('消息类型');
            $table->string('chat_ids')->default('')->comment('发送客户群ID，为空表示全部');
            $table->string('user_ids')->default('')->comment('发送客户ID，为空表示全部');
            $table->string('content', 1000)->default('')->comment('文本消息内容');
            $table->json('attachments')->nullable()->comment('附件消息集合');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wechat_chat_msg');
    }
};
